/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.gatech.gellinservlet.model;

import java.util.ArrayList;
import java.io.Serializable;

/**
 *
 * @author Tyler Powell
 */
public class Course implements IDable, Serializable
{
    private static int totalCourses = 0;
    
    private String name;
    private int ID;
    private ArrayList<Student> studentList;
    private ArrayList<Lab> labList;
    
    public Course(String name)
    {
        this.name = name;
        totalCourses++;
        ID = totalCourses;
        studentList = new ArrayList<Student>();
        labList = new ArrayList<Lab>();
    }
    
    /**
     * Add a student to this course.
     * @param stud The student to be added.
     */
    public void addStudent(Student stud)
    {
        studentList.add(stud);
    }
    
    /**
     * Add a lab to this course.
     * @param name Name of the lab.
     * @param teamMaxSize The max size a team in the lab can be.
     * @param teamDesignation The way a team can be made in the lab.
     * @param lm The lab manager that holds labs.
     * @param cm The course manager that holds courses.
     */
    public void addLab(Lab aLab)
    {
        labList.add(aLab);
    }
    
    /**
     * Removes a student from this course.
     * @param stud The student to be removed.
     */
    public void removeStudent(Student stud)
    {
        studentList.remove(stud);
    }
    
    /**
     * Removes a lab from this course.
     * @param lab The lab to be removed.
     */
    public void removeLab(Lab lab)
    {
        labList.remove(lab);
    }
    
    public int getID()
    {
        return ID;
    }

    public ArrayList<Lab> getLabList()
    {
        return labList;
    }

    public String getName()
    {
        return name;
    }

    public ArrayList<Student> getStudentList()
    {
        return studentList;
    }

    public static int getTotalCourses()
    {
        return totalCourses;
    }

    public static void setTotalCourses(int totalCourses)
    {
        Course.totalCourses = totalCourses;
    }
    
    
    public String toString()
    {
        return name;
    }
    
    public int compareTo(Object o)
    {
        return toString().compareTo(((Course)o).toString());
    }
}
